<?php
namespace pinduoduo\Request;

use pinduoduo\AbstractInterface\Request;

class PddDdkOauthGoodsSearchRequest extends Request
{
    /**
     * 多多进宝商品查询
     * @var string
     */
    private $type = 'pdd.ddk.oauth.goods.search';

    /**
     * 活动商品标记数组，例：[4,7]，4-秒杀，7-百亿补贴，10851-千万补贴，11879-千万神券，10913-招商礼金商品，31-品牌黑标，10564-精选爆品-官方直推爆款，10584-精选爆品-团长推荐，24-品牌高佣，其他的值请忽略
     * @var
     */
    private $activityTags;

    /**
     * 自定义屏蔽一级/二级/三级类目ID，自定义数量不超过20个;使用pdd.goods.cats.get接口获取cat_id
     * @var
     */
    private $blockCats;

    /**
     * 屏蔽商品类目包：1-拼多多小程序屏蔽的类目&关键词;2-虚拟类目;3-医疗器械;4-处方药;5-非处方药
     * @var
     */
    private $blockCatPackages;

    /**
     * 商品类目ID，使用pdd.goods.cats.get接口获取
     * @var
     */
    private $catId;

    /**
     * 自定义参数，为链接打上自定义标签；自定义参数最长限制64个字节；格式为： {"uid":"11111","sid":"22222"} ，其中 uid 用户唯一标识，可自行加密后传入，每个用户仅且对应一个标识，必填； sid 上下文信息标识，例如sessionId等，非必填。该json字符串中也可以加入其他自定义的key。（如果使用GET请求，请使用URLEncode处理参数）
     * @var
     */
    private $customParameters;

    /**
     * 是否使用工具商专属推广计划，默认为false
     * @var
     */
    private $forceAuthDuoId;

    /**
     * 商品主图类型：1-场景图，2-白底图，默认为0
     * @var
     */
    private $goodsImgType;

    /**
     * 商品goodsSign列表，例如：["c9r2omogKFFAc7WBwvbZU1ikIb16_J3CTa8HNN"]，支持通过goodsSign查询商品。goodsSign是加密后的goodsId, goodsId已下线，请使用goodsSign来替代。使用说明：https://jinbao.pinduoduo.com/qa-system?questionId=252
     * @var
     */
    private $goodsSignList;

    /**
     * 是否为品牌商品
     * @var
     */
    private $isBrandGoods;

    /**
     * 商品关键词，与opt_id字段选填一个或全部填写。可支持goods_id、拼多多链接（即拼多多app商详的链接）、进宝长链/短链（即为pdd.ddk.goods.promotion.url.generate接口生成的长短链）
     * @var
     */
    private $keyword;

    /**
     * 翻页时建议填写前页返回的list_id值
     * @var
     */
    private $listId;

    /**
     * 店铺类型，1-个人，2-企业，3-旗舰店，4-专卖店，5-专营店，6-普通店（未传为全部）
     * @var
     */
    private $merchantType;

    /**
     * 店铺类型数组，例如：[1,2]
     * @var
     */
    private $merchantTypeList;

    /**
     * 商品标签类目ID，使用pdd.goods.opt.get获取
     * @var
     */
    private $optId;

    /**
     * 默认值1，商品分页数
     * @var
     */
    private $page;

    /**
     * 默认100，每页商品数量
     * @var
     */
    private $pageSize;

    /**
     * 推广位id
     * @var
     */
    private $pid;

    /**
     * 筛选范围列表 样例：[{"range_id":0,"range_from":1,"range_to":1500},{"range_id":1,"range_from":1,"range_to":1500}]
     * @var
     */
    private $rangeList;

    /**
     * 排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序，28-描述评分击败同类店铺百分比降序，29-物流评分击败同类店铺百分比升序，30-物流评分击败同类店铺百分比降序，31-服务评分击败同类店铺百分比升序，32-服务评分击败同类店铺百分比降序
     * @var
     */
    private $sortType;

    /**
     * 是否使用个性化推荐，true表示使用，false表示不使用，默认true。
     * @var
     */
    private $useCustomized;

    /**
     * 是否只返回优惠券的商品，false返回所有商品，true只返回有优惠券的商品
     * @var
     */
    private $withCoupon;


    public function setType($type)
    {
        $this->type = $type;
    }

    public function getType()
    {
        return $this->type;
    }

    public function setActivityTags($activityTags)
    {
        $this->activityTags = $activityTags;
    }

    public function getActivityTags()
    {
        return $this->activityTags;
    }

    public function setBlockCats($blockCats)
    {
        $this->blockCats = $blockCats;
    }

    public function getBlockCats()
    {
        return $this->blockCats;
    }

    public function setBlockCatPackages($blockCatPackages)
    {
        $this->blockCatPackages = $blockCatPackages;
    }

    public function getBlockCatPackages()
    {
        return $this->blockCatPackages;
    }

    public function setCatId($catId)
    {
        $this->catId = $catId;
    }

    public function getCatId()
    {
        return $this->catId;
    }

    public function setCustomParameters($customParameters)
    {
        $this->customParameters = $customParameters;
    }

    public function getCustomParameters()
    {
        return $this->customParameters;
    }

    public function setForceAuthDuoId($forceAuthDuoId)
    {
        $this->forceAuthDuoId = $forceAuthDuoId;
    }

    public function getForceAuthDuoId()
    {
        return $this->forceAuthDuoId;
    }

    public function setGoodsImgType($goodsImgType)
    {
        $this->goodsImgType = $goodsImgType;
    }

    public function getGoodsImgType()
    {
        return $this->goodsImgType;
    }

    public function setGoodsSignList($goodsSignList)
    {
        $this->goodsSignList = $goodsSignList;
    }

    public function getGoodsSignList()
    {
        return $this->goodsSignList;
    }

    public function setIsBrandGoods($isBrandGoods)
    {
        $this->isBrandGoods = $isBrandGoods;
    }

    public function getIsBrandGoods()
    {
        return $this->isBrandGoods;
    }

    public function setKeyWord($keyword)
    {
        $this->keyword = $keyword;
    }

    public function getKeyWord()
    {
        return $this->keyword;
    }

    public function setListId($listId)
    {
        $this->listId = $listId;
    }

    public function getListId()
    {
        return $this->listId;
    }

    public function setMerchantType($merchantType)
    {
        $this->merchantType = $merchantType;
    }

    public function getMerchantType()
    {
        return $this->merchantType;
    }

    public function setMerchantTypeList($merchantTypeList)
    {
        $this->merchantTypeList = $merchantTypeList;
    }

    public function getMerchantTypeList()
    {
        return $this->merchantTypeList;
    }

    public function setOptId($optId)
    {
        $this->optId = $optId;
    }

    public function getOptId()
    {
        return $this->optId;
    }

    public function setPage($page)
    {
        $this->page = $page;
    }

    public function getPage()
    {
        return $this->page;
    }

    public function setPageSize($pageSize)
    {
        $this->pageSize = $pageSize;
    }

    public function getPageSize()
    {
        return $this->pageSize;
    }

    public function setPid($pid)
    {
        $this->pid = $pid;
    }

    public function getPid()
    {
        return $this->pid;
    }

    public function setRangeList($rangeList)
    {
        $this->rangeList = $rangeList;
    }

    public function getRangeList()
    {
        return $this->rangeList;
    }

    public function setSortType($sortType)
    {
        $this->sortType = $sortType;
    }

    public function getSortType()
    {
        return $this->sortType;
    }

    public function setUseCustomized($useCustomized)
    {
        $this->useCustomized = $useCustomized;
    }

    public function getUseCustomized()
    {
        return $this->useCustomized;
    }

    public function setWithCoupon($withCoupon)
    {
        $this->withCoupon = $withCoupon;
    }

    public function getWithCoupon()
    {
        return $this->withCoupon;
    }

    public function getParams()
    {
        $params = [
            'type'               => $this->type,
            'activity_tags'      => $this->activityTags,
            'block_cat_packages' => $this->blockCatPackages,
            'block_cats'         => $this->blockCats,
            'cat_id'             => $this->catId,
            'custom_parameters'  => $this->customParameters,
            'force_auth_duo_id'  => $this->forceAuthDuoId,
            'goods_img_type'     => $this->goodsImgType,
            'goods_sign_list'    => $this->goodsSignList,
            'is_brand_goods'     => $this->isBrandGoods,
            'keyword'            => $this->keyword,
            'list_id'            => $this->listId,
            'merchant_type'      => $this->merchantType,
            'merchant_type_list' => $this->merchantTypeList,
            'opt_id'             => $this->optId,
            'page'               => $this->page,
            'page_size'          => $this->pageSize,
            'pid'                => $this->pid,
            'range_list'         => $this->rangeList,
            'sort_type'          => $this->sortType,
            'use_customized'     => $this->useCustomized,
            'with_coupon'        => $this->withCoupon,
        ];
        $buildParams = [];
        foreach ($params as $key => $value) if ($value === 0) $buildParams[$key] = $value;
        return array_merge(array_filter($params), $buildParams);
    }
}
